Thread: Problem With undefined reference to `WinMain@16' in Code::Blocks Version 10.5 2011

  1. #1
    Registered User
    Join Date
    Jul 2011
    Posts
    10

    Problem With undefined reference to `WinMain@16' in Code::Blocks Version 10.5 2011

    okay so im trying to test out my code with the virtual keywords and i dont seem to know what is happening here with this error

    Code:
    #include <iostream>
    using namespace std;
    
    
    int main()
    {
        
        {
               cout << "hello my name is dominic test";
        }
        int myass;
    
        myass = 1 + 1 =;
    
        int dooshbag 2 + 2 =;
        
        virtual bool myass *dooshbag;
    
        system ("pause");
        return 0;
    }
    ERROR
    c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4. 1\..\..\..\libmingw32.a(main.o):main.c|| undefined reference to `WinMain@16'|


    iv looked at forums on this and i have made my file a c++ file tbh i think its a linker issue with dlls from windows 7 but thats just a guess at it

    or a code error that im not seeing which would be very typical :P

    i know my code is not cleaner *cba*

    i also tried doing the hashinclude <iostream.h>

    maybe im using the virtual keyword wrong and the meaning of it is wrong? doubt it tho
    Last edited by Noobscratcher; 07-08-2011 at 02:58 AM.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    I would expect several compile errors from that, e.g.,
    Code:
    MODE:strict errors C++ C++0x_extensions
    
    "ComeauTest.c", line 13: error: expected an expression
          myass = 1 + 1 =;
                         ^
    
    "ComeauTest.c", line 13: error: expression must be a modifiable lvalue
          myass = 1 + 1 =;
                  ^
    
    "ComeauTest.c", line 15: error: expected a ";" (perhaps on the previous statement)
          int dooshbag 2 + 2 =;
                       ^
    
    "ComeauTest.c", line 17: error: invalid specifier outside a class declaration
          virtual bool myass *dooshbag;
          ^
    
    "ComeauTest.c", line 17: error: "myass" has already been declared in the current
              scope
          virtual bool myass *dooshbag;
                       ^
    
    "ComeauTest.c", line 17: error: expected a ";" (perhaps on the previous statement)
          virtual bool myass *dooshbag;
                             ^
    
    "ComeauTest.c", line 11: warning: variable "myass" was set but never used
          int myass;
              ^
    
    "ComeauTest.c", line 15: warning: variable "dooshbag" was declared but never
              referenced
          int dooshbag 2 + 2 =;
              ^
    
    "ComeauTest.c", line 17: warning: variable "myass" was declared but never referenced
          virtual bool myass *dooshbag;
                       ^
    
    6 errors detected in the compilation of "ComeauTest.c".
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Jul 2011
    Posts
    10
    Compiler issue.com ant it lol god sake nothing works the first time can you help me then where would be my next step from this point onwards and how do you know what the next plan of action is anyways so i can learn from it

    ofc i could read your errors but i wouldnt get the meaning of it all
    Last edited by Noobscratcher; 07-08-2011 at 03:05 AM.

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Noobscratcher
    Compiler issue.com ant it lol god sake nothing works the first time can you help me then where would be my next step from this point onwards and how do you know what the next plan of action is anyways?
    You should:
    • Write in proper sentences.
    • Learn C++ from say, a beginner's book.
    • Decide on the requirements of the program that you set out to write.


    Quote Originally Posted by Noobscratcher
    maybe im using the virtual keyword wrong and the meaning of it is wrong? doubt it tho
    I am absolutely certain that you have no clue as to the valid uses of the virtual keyword.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User
    Join Date
    Jul 2011
    Posts
    10
    all i need is my problem fixed? so i can learn from your wording on how to fix it i learn by doing and telling not from reading books infact i hate reading from most books because its mostly very general and bias towards coders and not really friendly at all and doesn't explain the meaning of everything in pure english so one person who isnt a computer geek can go in and understand so he can become a coder geek im sorry if this ........es you off its not intenshonall
    Last edited by Noobscratcher; 07-08-2011 at 03:11 AM.

  6. #6
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Noobscratcher
    all i need is my problem fixed?
    It is impossible to fix your problem when you have not told us what your program is supposed to do, considering that it is unclear from the code what your program is supposed to do.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  7. #7
    Registered User
    Join Date
    Jul 2011
    Posts
    10
    Thank you for saying that

    im just looking at virtual keywords and seeing how they work atm!

    but then i got that fail of an error and felt like Foisting my computer box into my ceiling

  8. #8
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Noobscratcher
    im just looking at virtual keywords and seeing how they work atm!
    So your idea was to just try and code something with the virtual keyword and see if it works, and if it didn't, you post the code on a forum hoping someone will come up with an example that works? Sorry, but you're headed for disaster.

    Where did you come across the virtual keyword? What do you think it is for?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  9. #9
    Registered User
    Join Date
    Jul 2011
    Posts
    10
    Quote Originally Posted by laserlight View Post
    So your idea was to just try and code something with the virtual keyword and see if it works, and if it didn't, you post the code on a forum hoping someone will come up with an example that works? Sorry, but you're headed for disaster.

    Where did you come across the virtual keyword? What do you think it is for?
    i didnt think they would be this big problem tbh i dont understand this problem provoking that c++ brings its like unbearable but anyways

    the meaning of virtual is to give dynamic access and i read somewhere that it may even create virtual tables tht store arrays but i was looking at the dynamic access meaning first to see if it was true or not

    then i got that error
    Last edited by Noobscratcher; 07-08-2011 at 03:28 AM.

  10. #10
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Noobscratcher
    the meaning of virtual is to give dynamic access and i read somewhere that it may even create virtual tables tht store arrays but i was looking at the dynamic access meaning first to see if it was true or not
    You read that somewhere? And you are the same person who wrote:
    Quote Originally Posted by Noobscratcher
    i learn by doing and telling not from reading books infact i hate reading from most books because its mostly very general and bias towards coders and not really friendly at all and doesn't explain the meaning of everything in pure english so one person who isnt a computer geek can go in and understand so he can become a coder geek
    I am going to point you to this tutorial on polymorphism, though I am not sure if there is a point because your hapzard acquisition of fundamental C++ knowledge means that you might not even understand what is a class.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  11. #11
    Registered User
    Join Date
    Jul 2011
    Posts
    10
    a class is a like a storage point for specific variables that can be called to run multitude of c++ statements then say a int mostly but can be used for other things id imagine but its more major then say a interger which is less minor then a char which is a small version of interger which is used to speed up applications,etc if used correctly.

    i ant stupid i just learn differently

    also im looking to do OpenGl programming and SDL And! OpenAL i just want to get the hang of wxwidgets first but i need to fully grasp the meaning of some c++ keywords and symbols before i move forward in my tutorials of wxwidgets
    Last edited by Noobscratcher; 07-08-2011 at 04:42 AM.

  12. #12
    Registered User
    Join Date
    Jul 2011
    Posts
    10
    Virtual members
    A member of a class that can be redefined in its derived classes is known as a virtual member. In order to declare a member of a class as virtual, we must precede its declaration with the keyword virtual:


    so this is how i interpretate this

    so basically a variable of a class and what virtual does is allows it to be dynamic class so its a access point which is what i said lol but you were telling me that it gives dynamic access but only to classes is what your trying to tell me? or?
    Last edited by Noobscratcher; 07-08-2011 at 04:56 AM.

  13. #13
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Noobscratcher
    a class is a like a storage point for specific variables that can be called to run multitude of c++ statements then say a int mostly
    It sounds like you are confusing classes with objects, and then "specific variables that can be called to run multitude of c++ statements then say a int mostly" does not make sense.

    Quote Originally Posted by Noobscratcher
    i ant stupid i just learn differently
    I am not saying that you are stupid, but "just learn differently"? Everyone with any decent proficiency in programming learned it by doing. But they did not learn it only by doing: they had books, notes and tutorials that they read, and perhaps teachers that they listened and consulted. Pretending that you are different and hence must learn by writing test programs out of thin air to discover the syntax and semantics of a programming language is just setting yourself up for failure.

    Oh, and please do not try to use this forum as some anonymous bunch of teachers for you to consult.

    Quote Originally Posted by Noobscratcher
    i need to fully grasp the meaning of some c++ keywords and symbols before i move forward in my tutorials of wxwidgets
    That would be wise.

    Quote Originally Posted by Noobscratcher
    so basically a variable of a class and what virtual does is allows it to be dynamic class so its a access point which is what i said lol but you were telling me that it gives dynamic access but only to classes is what your trying to tell me? or?
    No, in this context the virtual keyword declares the member function as virtual, i.e., you can override it in a child class. You have to understand this in the context of inheritance and polymorphism.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  14. #14
    Registered User
    Join Date
    Jul 2011
    Posts
    10
    okay this isnt the forum for help this is the forum for bashing people with different philsophys in a nice way :P thanks ill keep that in mind for my next visit should have listend when they said quiz on a tutorial on cprogramming.com i mean who does quizzes lol

  15. #15
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Obviously you do not listen and try to push the blame upon those who try to help you. Well, it's your loss. Good luck with your failing.
    I will also recommend that you learn how to split sentences instead of writing one long unreadable block of text. There is a reason we have sentences, you know.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. problem with undefined reference
    By z9d in forum Windows Programming
    Replies: 2
    Last Post: 11-03-2010, 05:26 PM
  2. Undefined Reference to 'WinMain@16'
    By Mossypne in forum C Programming
    Replies: 3
    Last Post: 08-04-2010, 07:16 AM
  3. undefined reference to `WinMain@16'
    By Marksman in forum C++ Programming
    Replies: 11
    Last Post: 09-29-2006, 06:32 AM
  4. compile: undefined reference to WinMain@16
    By Xarr in forum C++ Programming
    Replies: 3
    Last Post: 06-08-2004, 01:29 PM
  5. Undefined reference problem
    By Speedkill in forum C++ Programming
    Replies: 3
    Last Post: 09-30-2003, 01:42 PM